<template>
  <el-space :fill-ratio="49" wrap>
    <el-card class="box-card">
      <template #header>
        <div class="card-header">
          <span>设备支架预焊件</span>
        </div>
      </template>
      <div style="display: flex; align-items: baseline; margin-bottom: 10px">
        <el-upload
          v-model:file-list="fileListHK"
          :icon="Download"
          class="upload-demo"
          action="#"
          multiple
          :show-file-list="true"
          :http-request="() => {}"
          accept=".xlsx"
        >
          <el-button style="margin-right: 10px" size="small" type="success"
            >选择文件（仅选择xlsx类型）</el-button
          >
          <!-- <template #tip>
                        <div class="el-upload__tip">只能上传xlsx文件</div>
                      </template> -->
        </el-upload>
        <el-button size="small" type="warning" @click="uploadTableHKSH"
          >上传文件</el-button
        >
        <el-button size="small" type="warning" @click="createPreWeldedPartFiles"
          >生成管架连接板文件</el-button
        >
      </div>
    </el-card>
    <el-card class="box-card" style="width: 48%">
      <template #header>
        <div class="card-header">
          <span>梯子平台预焊件</span>
        </div>
      </template>
      <div style="display: flex; align-items: baseline; margin-bottom: 10px">
        &nbsp;&nbsp;
        <el-upload
          v-model:file-list="fileListHKTow"
          :icon="Download"
          class="upload-demo"
          action="#"
          multiple
          :show-file-list="true"
          :http-request="() => {}"
          accept=".xlsx"
        >
          <el-button style="margin-right: 10px" size="small" type="success"
            >选择文件（仅选择xlsx类型）</el-button
          >
          <!-- <template #tip>
                        <div class="el-upload__tip">只能上传xlsx文件</div>
                      </template> -->
        </el-upload>
        <el-button size="small" type="warning" @click="uploadTableHKSHTow"
          >上传文件</el-button
        >
        <el-button size="small" type="danger" @click="downloadTemplate"
          >下载模板</el-button
        >
      </div>
    </el-card>
  </el-space>
</template>

<script setup>
import { ref, reactive, onMounted, watch, nextTick } from "vue";
import {
  Download,
  Upload,
  Calendar,
  Check,
  Delete,
  Edit,
  Message,
  Search,
  Star,
  DocumentCopy,
  Top,
  Bottom,
  Guide,
  Coordinate,
} from "@element-plus/icons-vue";

let props = defineProps(["fileListHK", "fileListYHjTow"]);
let emit = defineEmits([
  "uploadTableHKSH",
  "createPreWeldedPartFiles",
  "uploadTableHKSHTow",
  "downloadTemplate",
]);
let fileListHK = ref([]);
let fileListHKTow = ref([]);
watch(
  props,
  () => {
    fileListHK.value = props.fileListHK;
    fileListHKTow.value = props.fileListYHjTow;
    console.log(fileListHKTow.value)
  },
  { deep: true }
);

let uploadTableHKSH = () => {
  emit("uploadTableHKSH", fileListHK.value);
};

let createPreWeldedPartFiles = () => {
  emit("createPreWeldedPartFiles");
};

let uploadTableHKSHTow = () => {
  emit("uploadTableHKSHTow", fileListHKTow.value);
};

let downloadTemplate = () => {
  emit("downloadTemplate");
};
</script>

<style></style>
